//引入 api
import {
  getMovieList
} from '../../api/index'

//引入sotre
import store from '../../store/index'

//引入movie常量
import { MOVIELIST } from '../constant/movieConst'

//异步请求函数
export const getmovieAction = () => {
  //因为axios请求是异步的 使用async await
  //当
  return async() => {
    const re = await getMovieList()
    store.dispatch({
      type: MOVIELIST,
      data: re.data.data.list
    })
  }
}